package com.youlai.system.model.pojo;

import lombok.Data;
import org.jetbrains.annotations.NotNull;

/**
 * ClassName: Stats
 * Package: com.youlai.system.model.pojo
 * Description:
 *
 * @Author LIEX
 * @create 2024/3/1116:31
 * @Version 1.0
 */
@Data
public class ProductStatsInfo implements Comparable{
    Integer pvNum;
    Integer uvNum;
    Integer collect;
    Integer saleNum;
    String productName;

    @Override
    public int compareTo(@NotNull Object o) {
        if(o instanceof ProductStatsInfo p){
            if(pvNum-p.pvNum!=0){
                return  -pvNum+p.pvNum;
            }
            if(uvNum-p.uvNum!=0){
                return -uvNum+p.uvNum;
            }
         if(collect-p.collect!=0){
             return -collect+p.collect;
         }
         return -saleNum+p.saleNum;
        }
        return 0;
    }
}
